package com.stu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.stu.entity.SysUser;
import com.stu.mapper.SysUserMapper;
import com.stu.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserServiceImpl implements SysUserService {

    @Autowired
    SysUserMapper userMapper;
    @Override
    public SysUser login(SysUser sysUser) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("user_name", sysUser.getUserName());
        queryWrapper.eq("pass_word", sysUser.getPassWord());
        List<SysUser> users = userMapper.selectList(queryWrapper);
        if (null != users && users.size() > 0) {
            return users.get(0);
        }
        return null;
    }
}
